import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  // {
  //   path: '/',
  //   redirect: '/layout'
  // },
  {
    path: '/login',
    name: 'login',
    component: () => import('@/views/login')
  },
  {
    path: '/',
    name: 'layout',
    component: () => import('@/views/layout'),
    children: [{
      path: '',
      name: 'shoye',
      component: () => import('@/views/shoye')
    },
    {
      path: '/wenda',
      name: 'wenda',
      component: () => import('@/views/wenda')
    },
    {
      path: '/shipin',
      name: 'shipin',
      component: () => import('@/views/shipin')
    },
    {
      path: '/wode',
      name: 'wode',
      component: () => import('@/views/wode')
    },
    {
      path: '/shosuo',
      name: 'shosuo',
      component: () => import('@/views/shosuo')
    }
    ]
  },
  {
    path: '/article/:articleId',
    name: 'article',
    component: () => import('@/views/article'),
    props: true // 开启props传参
  },
  {
    path: '/user/profile',
    name: 'user-profile',
    component: () => import('@/views/user-profile')
  }

]

const router = new VueRouter({
  routes
})

export default router
